package com.jianan.mis.service;

import java.util.List;

import com.jianan.mis.data.dao.CountryDao;
import com.jianan.mis.data.domain.Country;

public class CountryServiceImpl implements CountryService {

	private CountryDao countryDao;

	public void save(Country country) {
		countryDao.save(country);
	}

	public void update(Country country) {
		countryDao.saveOrUpdate(country);
	}

	public void remove(Country country) {
		country.setMaterials(null);
		countryDao.remove(country);
	}

	public List<Country> getAll() {
		return countryDao.getAll(Country.class, "Name", true);
	}
	
	public void findByName(String name) {
		countryDao.findUniqueBy(Country.class, "Name", name);
	}

	public void setCountryDao(CountryDao countryDao) {
		this.countryDao = countryDao;
	}

}
